<template>
  <el-dialog :model-value="props.distributionModulShow" :before-close="()=>emit('cancel')" title="分配角色" width="400">
    <el-select
      v-model="value1"
      multiple
      :width="props.width"
    >
      <el-option
        v-for="item in options"
        :key="item.id"
        :label="item.name"
        :value="item.id"
      />
    </el-select>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('cancel')">取消</el-button>
        <el-button type="primary" @click="myconfirm">
          确认
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, Ref, ref } from 'vue';
const props=defineProps(['value','options','distributionModulShow','width']);
const emit=defineEmits(['cancel','myconfirm','cancel']);
const value1:Ref<number[]>=ref([]);
value1.value=props.value;
console.log(value1.value);
// 确认事件
const myconfirm=()=>{
  emit('myconfirm',value1.value)
}
</script>
<style scoped>
.el-button--text {
  margin-right: 15px;
}
.el-select {
  width: 300px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
